package edu.sctu.practice.class01.zhoumengxue.assign.assign03.assign03_2;

/**
 * Created by ASUS on 2015/10/22.
 */
public class ComparableCylinder extends Cylinder implements Comparable {

    public ComparableCylinder(double radius, double volume) {
        super(radius, volume);
    }

    @Override
    public int compareTo(Object o) {

        if (findVolume() > ((ComparableCylinder) o).findVolume()) {
            return 0;
        } else {
            return 1;
        }
    }

    public double findVolume() {

        return 2 * Math.PI * radius * height + 2 * radius * radius * Math.PI;
    }

}
